#ifndef MENU_SYS_H
#define MENU_SYS_H

#include "menu.h"
#include "dish.h"
#include "secure_transfer.h"
#include <qlist.h>
#include <qvector.h>
#include <qiconview.h>
#include <qtextview.h> 
#include <qstring.h>
#include <qtextstream.h>
#include <stdlib.h>
#include <vector>
#include <qlistbox.h>
#include <qfile.h>
#include <qtextcodec.h>
#include <qtextstream.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qmessagebox.h>

class menu_sys:public menu
{
private:
	int desk_no;//the number of the desk
	std::vector<dish*> dishes;//all of the dishes available
	std::vector<int> selected;//the index of selected dishes in varialbe dishes
	float total_price;//the total price of selected dishes
	data_transfer *ptransfer;//use this to contact with server
	QTextCodec *pcodec;//use this to change encodings

	//get the index of dish in varialbe dishes by dish number
	int dish_index(int dish_no);
public:
	menu_sys( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
	~menu_sys();

	//init all labels in forms
	bool init_labels();

	//init all buttons in forms
	bool init_buttons();

	//init var dishes from file
	bool init_dishes();

	//init var desk_no in some way
	bool init_desk_no();

	//init var ptransfer
	bool init_ptransfer();

	//display a messagebox containing hint message with an OK button
	//param message is the message you want to display
	//param message should use utf-8 encoding
	void messagebox(const char* message);

	//when the customer selected a different dish's picture,this function update the 
	//dish's description which displays to the customer.
	virtual void update_display();

	//when the customer order a dish,this function update var selected,var total_price,
	//the list box showing the selected list and the text box showing the total price
	//according to the picture of dishes which customer selects
	virtual void update_selected();

	//when the customer clict the delete button,this function remove the
	//dish selected in the selected list from var selected and update the
	//list box showing the selected list.
	virtual void delete_selected();

	//when the customer clict the clear button,this function remove all of
	//dishes selected in the selected list from var selected and clear the 
	//text in the list box. 
	virtual void clear_selected();

	//when the customer clict the confirm button,this function send the order information
	//to the server.
	virtual void confirm();

	//close the form
	virtual void close();
};


#endif
